﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;

namespace CamelotSQLCommander
{
    public static class Extensions
    {
        public static Control FindControlRecursive(this Control container, string name)
        {
            if ((container.ID != null) && (container.ID.Equals(name)))
                return container;

            return (from Control ctrl in container.Controls select FindControlRecursive(ctrl, name)).FirstOrDefault(foundCtrl => foundCtrl != null);
        }
    }
}
